New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add HTTP Upgrade support to Response. #1376
Conversation
05202a2
to
f6d6e3d
Compare
3f511ca
to
56dc927
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alrighty, let's go! Thanks for the work, and for continuing to remind me to pay attention.
|
No problem! Is a release scheduled any time soon so we can get a version with this on crates.io? |
This adds a new method,
Response::upgrade
, which consumes the given Response and returns a future for a possible HTTP upgrade. On success the future will yield a new type,Upgraded
(a thin wrapper around hyper'sUpgraded
type), which implementsAsyncRead
/AsyncWrite
over the underlying connection.As part of this, reqwest's
Response
type now no longer takes apart the originalhyper::Response
but rather stores it and maps the Body type toDecoder
. This along with hyperium/hyper#2680 makes the new upgrade method just a thin wrapper around hyper's.